<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <style>
        .box {
            width: 100px;
            height: 100px;
            background-color: red;
        }

    </style>
</head>
<body>
    <div class="box"></div>
    <div id="box"></div>
    <ul>
        <li>1</li>
        <li>2</li><!-- 选这个 -->
        <li>3</li>
        <li>4</li>
    </ul>

    <script>
        // 选中#box
        var box = document.getElementById('box');
        // 选中第一个.box
        var box = document.getElementsByClassName('box')[0];
        // 选中所有的div
        var divList = document.getElementsByTagName('div'); // [div, div]

        // 选中第一个.box
        var box = document.querySelector('.box');
        // 选中#box
        var box = document.querySelector('#box');
        // 选中所有的div
        var divList = document.querySelectorAll('div');

        var li2 = document.querySelector('ul>li:nth-child(2)');
        console.log(li2);

        // console.log(box);
    </script>
</body>
</html>